<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

function getValueOfArray($array){
	if(!$array) return '';
	$tmp = array_values($array);
	return $tmp[0];
}

function getKeyOfArray($array){
	if(!$array) return '';
	$tmp = array_keys($array);
	return $tmp[0];
}

// ------------------------------------------------------------------------
function clone_($some)
{
   return (is_object($some)) ? clone $some : $some;
}

function trim_value(&$value) 
{ 
	$value = trim($value); 
}

function normal_chars($string)
{
    $string = htmlentities($string, ENT_QUOTES, 'UTF-8');
    $string = preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', $string);
    $string = preg_replace(array('~[^0-9a-z]~i', '~-+~'), ' ', $string);
    return trim($string);
}

function stringNumberTextFM($number){
	$str = (string) $number;
	$surfix = array(
		'1'=> 'st',
		'2'=> 'nd',
		'3'=> 'rd',
		'4'=> 'th',
		'5'=> 'th',
		'6'=> 'th',
		'7'=> 'th',
		'8'=> 'th',
		'9'=> 'th',
		'0'=> 'th'
	);
	$endStr =  $str[strlen($str)-1];
	$number = $str.$surfix[$endStr];
	$number = str_replace( array('11st','12nd','13rd'), array('11th','12th','13th'), $number);
	return $number;
}

function containsString($needle, $haystack){
	$find = false;
	foreach(explode(' ',$haystack) as $word){
		if(strcasecmp( trim($word), trim($needle) ) == 0){
			$find = true; 
			break;
		}
	}
    return $find;
}

define('TBL_ADVERTISING', 'default_cpg_advertising');
define('TBL_BET', 'default_cpg_bet');
define('TBL_CATEGORY_EVENT', 'default_cpg_category_event');

define('TBL_COIN_PACKAGES', 'default_cpg_coin_packages');
define('TBL_CONVERSION', 'default_cpg_conversion');
define('TBL_CONVERSION_SETTING', 'default_cpg_conversion_setting');

define('TBL_COUPON', 'default_cpg_coupon');
define('TBL_CURRENCY', 'default_cpg_currency');
define('TBL_EVENT', 'default_cpg_event');
define('TBL_MATCH', 'default_cpg_match');
define('TBL_ODDS', 'default_cpg_odds');

define('TBL_PRIZE', 'default_cpg_prize');
define('TBL_SHIPPING', 'default_cpg_shipping');
define('TBL_SPORT', 'default_cpg_sport');
define('TBL_SPORT_TEAM', 'default_cpg_sport_team');

define('TBL_STATUS', 'default_cpg_status');

define('TBL_TOURNAMENT', 'default_cpg_tournament');

define('TBL_TRANSACTION', 'default_cpg_transaction');
define('TBL_USER', 'default_cpg_user');
define('TBL_USER_TOURNAMENT', 'default_cpg_user_tournament');

define('TBL_STATE', 'default_cpg_state');
define('TBL_COUNTRY', 'default_cpg_country');
define('TBL_CITY', 'default_cpg_city');

define('TBL_EMAIL_SUBS','default_cpg_email_subscription');

define('TBL_PRE_DEFINE','default_cpg_pre_define_events');

define('TBL_OFFLINE_PAYMENT','default_cpg_offline_payment');
define('TBL_COD', 'default_cpg_cod_data');

define('TBL_CATEGORY_MANUAL', 'default_cpg_category_event_manual');
define('TBL_EVENT_MANUAL', 'default_cpg_event_manual');
define('TBL_BET_MANUAL', 'default_cpg_bet_manual');

define('TBL_SCORECARD', 'default_cpg_scorecard');

define('TBL_WEEKLY_PRIZE', 'default_cpg_weeky_prize');

define('TBL_AUCTION', 'default_cpg_auction');

define('TBL_MATCH_HISTORY' , 'default_cpg_xml_match_history');

define('TBL_EVENT_TOURNAMENT', 'default_cpg_tournament_event');
define('TBL_CATEGORY_TOURNAMENT', 'default_cpg_tournament_category_event');
define('TBL_BET_TOURNAMENT', 'default_cpg_tournament_bet');

define('TBL_BET_MANUAL_TOURNAMENT', 'default_cpg_bet_manual_tournament');
define('TBL_CATEGORY_MANUAL_TOURNAMENT', 'default_cpg_category_manual_tournament');





